﻿namespace Configuration.DataBase
{
	public static class ConfigurationHelper
	{
		public static Dictionary<string, string?> Clone(this IDictionary<string, string?> dict)
		{
			return dict.ToDictionary(kv => kv.Key, kv => kv.Value);
		}

		public static bool IsChanged(IDictionary<string, string?> oldDict, IDictionary<string, string?> newDict)
		{
			if (oldDict.Count != newDict.Count)
				return true;

			foreach (var kv in oldDict)
			{
				if (!newDict.TryGetValue(kv.Key, out var newValue) || kv.Value != newValue)
					return true;
			}
			return false;
		}
	}
}
